/*
 * @Author: syyao 
 * @Date: 2019-05-17 15:23:50 
 * @Last Modified by: syyao
 * @Last Modified time: 2019-06-11 19:33:14
 */
<template>
    <div id="app" style="height: 100%">
        <Row style="height: 100%">
            <i-col span="1" style="height: 100%;z-index:1;border-right:#e8e8e8 1px solid;">
                <Menu style="height: 100%;width: 100% "></Menu>
            </i-col>
            <i-col span="23"  style="min-height:100%;background-color: #F5F7F9;">
                <router-view/>
            </i-col>
        </Row>
        <Drawer :width="personWidth" v-model="isShowVisitor" class="drawer-background drawer">
            <vis :info="visitorInfo" :isfollow="isfollow" :pictures="visitorPictures"></vis>
        </Drawer>
    </div>
</template>

<style>
#app {
  font-family: "Avenir", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color: #2c3e50;
}

.drawer /deep/ .ivu-drawer-wrap{
  z-index: 2000
}

.drawer-background /deep/ .ivu-drawer-content {
  background-color: rgb(245, 247, 249);
}
</style>

<script>
import vis from "./components/visitor";
import Menu from "./components/Menu";
import GetUserInfo from "./js/GetUserInfo";

export default {
  components: { Menu,vis },
  created() {
    let _this = this;
    GetUserInfo.getUserInfo(this);
    // this.http.post(this, '/test').then(function (msg) {
    //     if (msg.data.code === '200') {
    //         _this.$Message.success('连接成功');
    //     } else {
    //         _this.$Message.error(msg.data.message);
    //     }
    // })
  },
  data(){
    return {
     isShowVisitor: false,
     visitorInfo:{},
     isfollow:false,
     visitorPictures:[]
    }
  },
  computed:{
    personWidth(){
      return 76
    }
  },
  watch:{
    "$store.state.visitorFilter.state": function(newVal) {
      //展示访客页面
      if (newVal === true) {
        let _this=this
        let Params = new URLSearchParams()
        Params.append("Id",this.$store.state.visitorFilter.id)
        this.http.post(this,'/GetOtherInfo',Params).then(function(msg){
          if(msg.data.code==='200'){
            _this.visitorInfo=msg.data.data
          }
        })
        let Params2 = new URLSearchParams()
        Params2.append("username",this.$store.state.visitorFilter.id)
        this.http.post(this,"/isConner",Params2).then(function(msg){
          if(msg.data.code==='205'){
            _this.isfollow=true
          }else{
            _this.isfollow=false
          }
        })
        
            let Params3 = new URLSearchParams()
            Params3.append("userId",this.$store.state.visitorFilter.id)
            this.http.post(this,'/getOtherMovement',Params3).then(function(msg){
                _this.visitorPictures=msg.data.data
            })
        this.isShowVisitor = newVal;
      }
    },
  }
};
</script>
